/**
 * PHOSIDE: PHosphorylation Site IDentification Engine.
 * Copyright 2009 Digital Biology Lab, University of Missouri.
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 3 of the License, or (at your option) any later
 * version. <p/> This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more
 * details.
 */

package phoside.io.fasta.parser;

import phoside.util.StaticFinalValues;

/**
 *
 * @author gjj
 */
public class DefaultHeaderRule
        extends RegExRuleImpl
        implements HeaderRule {

    public DefaultHeaderRule(final String accRegEx) {
        this(accRegEx, null, null, null);
    }

    public DefaultHeaderRule(final String accRegEx, final String symbolRegEx,
            final String descRegEx, final String speciesRegEx) {
        super();

        if (accRegEx==null) {
            throw new NullPointerException();
        }

        setAccessionRegExp(accRegEx);

        if (symbolRegEx!=null)
            setSymbolRegExp(symbolRegEx);

        if (descRegEx!=null)
            setDescriptionRegExp(descRegEx);
        
        if (speciesRegEx!=null)
            setSpeciesRegExp(speciesRegEx);
    }

    public String getAccessionRegExp() {
        return getFieldRegEx(StaticFinalValues.ACCESSION);
    }

    public String getSymbolRegExp() {
        return getFieldRegEx(StaticFinalValues.SYMBOL);
    }

    public String getDescriptionRegExp() {
        return getFieldRegEx(StaticFinalValues.DESCRIPTION);
    }

    public String getSpeciesRegExp() {
        return getFieldRegEx(StaticFinalValues.SPECIES);
    }

    protected void setAccessionRegExp(final String regExp) {
        if (regExp == null) {
            throw new NullPointerException();
        }

        setFieldRegEx(StaticFinalValues.ACCESSION, regExp);
    }

    protected void setSymbolRegExp(final String regExp) {
        setFieldRegEx(StaticFinalValues.SYMBOL, regExp);
    }

    protected void setDescriptionRegExp(final String regExp) {
        setFieldRegEx(StaticFinalValues.DESCRIPTION, regExp);
    }

    protected void setSpeciesRegExp(final String regExp) {
        setFieldRegEx(StaticFinalValues.SPECIES, regExp);
    }

}
